﻿@{
    Layout = null;
}
<!DOCTYPE html>
<html lang="en" class="login_page">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>登陆</title>

    <!-- Bootstrap framework -->
    <link rel="stylesheet" href="bootstrap/css/bootstrap.min.css" />
    <!-- theme color-->
    <link rel="stylesheet" href="css/blue.css" />
    <!-- tooltip -->
    <link rel="stylesheet" href="lib/qtip2/jquery.qtip.min.css" />
    <!-- main styles -->
    <link rel="stylesheet" href="css/style.css" />

    <!-- favicon -->
    <link rel="shortcut icon" href="favicon.ico" />
    <!--   <link href='http://fonts.googleapis.com/css?family=PT+Sans' rel='stylesheet' type='text/css'> -->
    <!--[if lt IE 9]>
    <script src="js/ie/html5.js"></script>
    <script src="js/ie/respond.min.js"></script>
    <![endif]-->

    <script src="js/jquery.min.js"></script>
    <script src="js/jquery.actual.min.js"></script>
    <script src="lib/validation/jquery.validate.js"></script>
    <script src="bootstrap/js/bootstrap.min.js"></script>
</head>
<body onkeypress="keyPress()" style="background:url(/img/bg.jpg) no-repeat center center">

    <div class="login_box">

        <form action="@Url.Content("~/index/Login")" method="post" id="login_form">
            <div class="top_b"><img height="30" width="30" src="@Url.Content("/Content/images/logo.png")" style="margin-top:-5px;" /> &nbsp;登录</div>
            <div class="alert alert-info alert-login">
                欢迎登录电商经济创新园区
            </div>
            <div class="cnt_b">
                <div class="form-group">
                    <div class="input-group">
                        <span class="input-group-addon input-sm"><i class="glyphicon glyphicon-user"></i></span>
                        <input class="form-control input-sm" type="text" id="username" name="username"
                               placeholder="请输入用户名(社会信用代码)" value="" />
                    </div>
                </div>
                <div class="form-group">
                    <div class="input-group">
                        <span class="input-group-addon input-sm"><i class="glyphicon glyphicon-lock"></i></span>
                        <input class="form-control input-sm" type="password" id="password" name="password"
                               placeholder="请输入密码" value="" />
                    </div>
                </div>
                <div class="form-group">
                    <div class="row">
                        <div class="col-xs-8">
                            <div class="input-group">
                                <span class="input-group-addon input-sm"><i class="glyphicon glyphicon-th-large"></i></span>
                                <input class="form-control input-sm " type="text" id="ValidateCode" name="ValidateCode"
                                       placeholder="请输入验证码" value="" />
                            </div>

                        </div>

                        <div class="col-xs-4 text-center" style="padding-top:1px;">
                            <img src="" onclick="chg1()" id="ValidateCode1" alt="" height="29px" width="55px">
                        </div>
                    </div>
                </div>
            </div>
            <div class="btm_b clearfix">
                <button class="btn btn-default btn-sm pull-right" id="Loginbtn" type="button">登陆</button>
                <span class="link_reg"><a href="#reg_form">新用户点击注册</a></span>
            </div>
        </form>

        <form action="@Url.Content("~/index/Login")" method="post" id="pass_form" style="display:none">
            <div class="top_b">重置密码</div>
            <div class="alert alert-info alert-login">
                如果你忘记登录密码，填写企业登记的用户名和短信号码获取验证码，填写正确的验证码后,点击重置密码进入重置页面
            </div>
            <div class="cnt_b">
                <div class="form-group">
                    <div class="input-group">
                        <span class="input-group-addon input-sm"><i class="glyphicon glyphicon-user"></i></span>
                        <input class="form-control input-sm" type="text" id="usernamePWD" name="usernamePWD"
                               placeholder="请输入用户名" value="" />
                    </div>
                </div>
                <div class="form-group">

                    <div class="input-group">
                        <span class="input-group-addon input-sm"><i class="glyphicon glyphicon-phone"></i></span>
                        <input type="text" placeholder="请输入你登记的手机号码" id="userPhone" name="userPhone" class="form-control input-sm" />
                    </div>


                </div>

                <div class="form-group">
                    <div class="row">
                        <div class="col-xs-8">
                            <div class="input-group">
                                <span class="input-group-addon input-sm"><i class="glyphicon glyphicon-th-large"></i></span>
                                <input class="form-control input-sm " type="text" id="ValidateCode3i" name="ValidateCode3i"
                                       placeholder="请输入验证码" value="" />
                            </div>

                        </div>

                        <div class="col-xs-4 text-center" style="padding-top:1px;">
                            <img src="" onclick="chg3()" id="ValidateCode3" alt="" height="29px" width="55px">
                        </div>
                    </div>
                </div>

                <div class="form-group">
                    <div class="row">
                        <div class="col-sm-6">
                            <div class="input-group ">
                                <span class="input-group-addon input-sm"><i class="glyphicon glyphicon-envelope"></i></span>
                                <input type="text" placeholder="验证码" class="form-control input-sm" id="DXYZM" name="DXYZM" />
                            </div>
                        </div>
                        <div class="col-sm-6">

                            <button type="button" id="myButton" data-loading-text="短信已发送" class="btn btn-primary btn-sm">
                                获取短信验证码
                            </button>
                        </div>
                    </div>
                </div>
            </div>
            <div class="btm_b tac">
                <button class="btn btn-default" type="button" id="rstPWD" name="rstPWD">重置密码</button>
            </div>
        </form>

        <form action="@Url.Content("~/index/Login")" method="post" id="reg_form" style="display:none">
            <div class="top_b">新用户注册</div>
            <div class="alert alert-warning alert-login">
                请填写正确的账户信息
            </div>


            <div class="cnt_b">

                <div class="form-group">
                    <div class="input-group">
                        <span class="input-group-addon input-sm"><i class="glyphicon glyphicon-user"></i></span>
                        <input class="form-control input-sm" type="text" id="r_username" name="r_username"
                               placeholder="用户名" value="">
                    </div>
                </div>
                <div class="form-group">
                    <div class="input-group">
                        <span class="input-group-addon input-sm"><i class="glyphicon glyphicon-lock"></i></span>
                        <input class="form-control input-sm" type="password" id="r_password" name="r_password"
                               placeholder="密码" value="">
                    </div>
                </div>
                <div class="form-group">
                    <div class="input-group">
                        <span class="input-group-addon input-sm"><i class="glyphicon glyphicon-lock"></i></span>
                        <input class="form-control input-sm" type="password" id="r_password2" name="r_password2"
                               placeholder="重复密码" value="">
                    </div>
                </div>
                <div class="form-group">
                    <div class="row">
                        <div class="col-xs-8">
                            <div class="input-group">
                                <span class="input-group-addon input-sm"><i class="glyphicon glyphicon-th-large"></i></span>
                                <input class="form-control input-sm " type="text" id="ValidateCode1" name="ValidateCode1"
                                       placeholder="请输入验证码" value="" />
                            </div>

                        </div>

                        <div class="col-xs-4" style="padding-top:1px;">
                            <img src="" onclick="chg2()" id="ValidateCode2" alt="" height="29px" width="55px">
                        </div>
                    </div>
                </div>
            </div>
            <div class="btm_b tac">
                <button class="btn btn-default" type="button" id="regbtn"> 注册</button>

               
            </div>
        </form>

        <div class="links_b links_btm clearfix" style="left:20%;width:60%;background-color:white;opacity:0.7;filter:alpha(opacity=70);">
            <span class="linkform" style="text-align: center; "><a href="#pass_form">忘记密码?点击找回密码</a></span>
            <span class="linkform" style="display:none"><a href="#login_form">返回登陆界面</a></span>
        </div>

    </div>


    <script>
        function keyPress() {
            if (event.keyCode && event.keyCode == 13) {

                $("#Loginbtn").trigger("click");

            }
        }

        $(document).ready(function () {

          
            chg1();
            chg2();
            chg3();
            $("#myButton").button();
            $('#myButton').on('click', function () {
                var usernamePWD = $("#usernamePWD").val();
                var userPhone = $("#userPhone").val();
                var ValidateCode3 = $("#ValidateCode3i").val();
                var that = this;
                $.ajax({
                    type: "POST",
                    url: '@Url.Content("~/index/SendPhone")',
                    data: {

                        usernamePWD: usernamePWD, userPhone: userPhone, ValidateCode3: ValidateCode3
                    },
                    error: function (data) {
                        alert(data);
                      
                    },
                    success: function (data) {
                        if (data == "ok") {
                            var $btn = $(that).button('loading').delay(60000).queue(function () {
                                $(that).button('reset');
                            });
                        }else
                        {


                            alert(data);

                        }

                    }
                });
               
                
            })

            $("#username").blur(function () {

                var oldVal = $(this).val();
                var oldVal = oldVal.TrimStartVal("0");

                var oldLen=oldVal.length;
                for (var i = 0; i < 8 - oldLen; i++) {
                    oldVal = "0" + oldVal;
                }
                $("#username").val(oldVal);
            });
            String.prototype.TrimStartVal = function(c)  
            {  
               
                    var rg=new RegExp("^"+c+"*");  
                    var str= this.replace(rg, '');  
                    return str;  
              
            }  
            //* boxes animation
            var form_wrapper = $('.login_box');
            function boxHeight() {
                form_wrapper.animate({ marginTop: (-(form_wrapper.height() / 2) - 24) }, 400);
            };
            form_wrapper.css({ marginTop: (-(form_wrapper.height() / 2) - 24) });
            $('.btm_b a,.link_reg a,.links_b a').on('click', function (e) {
                var target = $(this).attr('href'),
                        target_height = $(target).actual('height');
                $(form_wrapper).css({
                    'height': form_wrapper.height()
                });
                $(form_wrapper.find('form:visible')).fadeOut(400, function () {
                    form_wrapper.stop().animate({
                        height: target_height,
                        marginTop: (-(target_height / 2) - 24)
                    }, 500, function () {
                        $(target).fadeIn(400);
                         $('.links_btm .linkform').toggle();
                        $(form_wrapper).css({
                            'height': ''
                        });
                    });
                });
                e.preventDefault();
            });

            $("#Loginbtn").click(function () {

                var that = this;
                $(this).attr("disabled", "disabled");
                $.ajax({
                    type: "POST",
                    url: '@Url.Content("~/index/Login")',
                    data: $('#login_form').serialize(),
                    error: function (data) {
                        alert(data);
                        $(that).removeAttr("disabled");
                        window.location.reload();
                    },
                    success: function (data) {


                        $(that).removeAttr("disabled");

                        if (data == "登陆成功") {

                            window.location.href = '@Url.Action("Index","Home")';
                        } else if (data == "登陆成功,欢迎进入园区段管理系统") {
                        
                            window.location.href = '@Url.Action("Index", "AdminFront")';
                        } else {
                            alert(data);

                        }
                    }

                });


            });
            $("#regbtn").click(function () {

                var that = this;
                $(this).attr("disabled", "disabled");
                $.ajax({
                    type: "POST",
                    url: '@Url.Content("~/index/RegUser")',
                    data: $('#reg_form').serialize(),
                    error: function (data) {
                        alert(data);
                        $(that).removeAttr("disabled");
                        window.location.reload();
                    },
                    success: function (data) {


                        $(that).removeAttr("disabled");

                        if (data == "注册成功") {

                            window.location.href = '@Url.Action("Index", "Home")';
                        } else {
                            alert(data);

                        }
                    }

                });


            })

            $("#rstPWD").click(function () {

                var that = this;
                $(this).attr("disabled", "disabled");
                $.ajax({
                    type: "POST",
                    url: '@Url.Content("~/index/ResetPWD")',
                    data: $('#pass_form').serialize(),
                    error: function (data) {
                        alert(data);
                        $(that).removeAttr("disabled");
                        window.location.reload();
                    },
                    success: function (data) {

                       
                        $(that).removeAttr("disabled");

                        if (data == "重置成功") {
                            alert("重置成功,请重新修改密码");
                            window.location.href = '@Url.Action("Index", "Password", new {Type=1 })';
                        } else {
                            alert(data);

                        }
                    }

                });


            })

        });

        function chg1() {

            $("#ValidateCode1").attr("src", '@Url.Content("~/index/GetValidateCodeImage")' + "?s=" + (new Date().getTime()));

        }
        function chg2() {

            $("#ValidateCode2").attr("src", '@Url.Content("~/index/GetValidateCodeImage1")' + "?s=" + (new Date().getTime()));

        }
        function chg3() {

            $("#ValidateCode3").attr("src", '@Url.Content("~/index/GetValidateCodeImage3")' + "?s=" + (new Date().getTime()));

        }
    </script>

    <script type="text/javascript">



    </script>

</body>

</html>
